home *** CD-ROM | disk | FTP | other *** search
/ Pocket PC Game Programming / Pocket PC Game Programming.iso / source.exe / CH15 / Project02 / CAnimSprite.h next >
Encoding:
C/C++ Source or Header  |  2001-02-05  |  1.2 KB  |  51 lines

  1. //////////////////////////////////////////////////////////////////////
  2. // Pocket PC Game Programming
  3. // Chapter 9: Sprites and Animation
  4. //
  5. // CAnimSprite Header File
  6. //
  7. // This file includes the CAnimSprite class definition.
  8. //
  9. //////////////////////////////////////////////////////////////////////
  10.  
  11. #pragma once
  12.  
  13. #include "stdafx.h"
  14. #include "CSprite.h"
  15.  
  16. #define NUM_FRAMES 16
  17.  
  18. class CAnimSprite: public CSprite
  19. {
  20. private:
  21.     //CBitmap *source;
  22.     CBitmap *sprites[NUM_FRAMES];
  23.     int iCurFrame, iTotalFrames;
  24.     int iWidth, iHeight;
  25.  
  26.     HBITMAP hUnder;
  27.     HDC hdcUnder;
  28.  
  29. public:
  30.  
  31.     CAnimSprite(HDC hdc);
  32.     virtual ~CAnimSprite();
  33.     BOOL LoadTile(int iTileNum, LPTSTR lpFilename, int iWidth, int iHeight);
  34.     BOOL LoadAnimSeq(int iStartCol, int iNumFrames, int iRow, LPTSTR lpFilename, int iWidth, int iHeight);
  35.  
  36.     virtual BOOL BitBlit();
  37.     virtual BOOL StretchBlit(int dx, int dy);
  38.     virtual BOOL TransBlit(COLORREF clrTrans);
  39.  
  40.     int ImageWidth() { return iWidth; };
  41.     int ImageHeight() { return iHeight; };
  42.     void SetImageSize(int iImgWidth, int iImgHeight);
  43.     
  44.     void SetFrame(int iFrame);
  45.     int GetFrame() { return iCurFrame; };
  46.     void NextFrame();
  47.     void PrevFrame();
  48. };
  49.  
  50.  
  51.